﻿using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;

namespace Fierce.Cache
{
    /// <summary>
    /// 公共缓存类
    /// </summary>
    public static class CommonCache
    {
        private static IMemoryCache cache = new MemoryCache(Options.Create(new MemoryCacheOptions()));

        public static T GetOrCreate<T>(string key, Func<ICacheEntry, T> func)
        {
            return cache.GetOrCreate(key, func);
        }
    }
}
